_require local "../../basis.smi"
_require local "../../ml-yacc/lib/base.sig"
_require "../../ml-yacc/lib/lrtable.smi"
_require local "./utils.sig"
_require local "./sigs.sml"
(* _require "./mklrtable.smi" *)

structure ShrinkLrTable =
struct
  structure LrTable =
  struct
    datatype pairlist = datatype LrTable.pairlist
    datatype state = datatype LrTable.state
    datatype term = datatype LrTable.term
    datatype nonterm = datatype LrTable.nonterm
    datatype action = datatype LrTable.action
    type table = LrTable.table
    val numStates : table -> int
    val numRules : table -> int
    val describeActions : table -> state -> (term,action) pairlist * action
    val describeGoto : table -> state -> (nonterm,state) pairlist
    val action : table -> state * term -> action
    val goto : table -> state * nonterm -> state
    val initialState : table -> state
    exception Goto = LrTable.Goto
    val mkLrTable : {actions : ((term,action) pairlist * action) array,
                     gotos : (nonterm,state) pairlist array,
                     numStates : int, numRules : int,
                     initialState : state} -> table
  end
  val shrinkActionList : LrTable.table * bool ->
                         (int * int list *
                          ((LrTable.term,LrTable.action) LrTable.pairlist *
                           LrTable.action) list) * int
end
